<?php
namespace Home\Controller;
use Think\Controller;
use Repositories\QrcodeRep;
use Repositories\WeiChatRep;
class IndexController extends Controller {

    public function index(){
        $code = '3n9uWDv7vcf';
        // $qrcodeRep = new QrcodeRep($code);
        dump(session('platformUserInfo'));exit;
        if(!session('platformUserInfo')){
            $wechat = new WeiChatRep(-1);
            $wechat->setScopes('snsapi_userinfo')->setCallback('?s=Home/Index/authReturn/qrcode/'.$code.'/mchId/-1')->toAuth();
        }


    }

    //微信回调
    public function authReturn(){
        $mchId = I('mchId');
        $wechat = new WeiChatRep($mchId);
        $wechat->authReturn(I('qrcode'));
    }
}